package com.rainbow.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rainbow.entity.Salary;
import com.rainbow.mapper.SalaryMapper;
import com.rainbow.service.SalaryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author rainbow
 **/
@Service
@Transactional
public class SalaryServiceImpl extends ServiceImpl<SalaryMapper, Salary> implements SalaryService {
    @Override
    public int addSalary(Salary salary) {
        return baseMapper.addSalary(salary);
    }

    @Override
    public List<Salary> getAllSalary() {
        return baseMapper.getAllSalary();
    }

    @Override
    public int updateSalary(Salary salary) {
        return baseMapper.updateSalary(salary);
    }

    @Override
    public int deleteSalary(String ids) {
        String[] split = ids.split(",");
        return baseMapper.deleteSalary(split);
    }

    @Override
    public int updateEmpSalary(Integer sid, Long eid) {
        baseMapper.deleteSalaryByEid(eid);
        return baseMapper.addSidAndEid(sid, eid);
    }
}
